﻿using BusinessLayer;
using EntitiesLayer;
using QuiddichWPF.Config;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace QuiddichWPF
{
    /// <summary>
    /// Logique d'interaction pour CupWindow.xaml
    /// </summary>
    public partial class CupWindow : Window
    {
        public CupWindow()
        {
            InitializeComponent();

            
        }

        /// <summary>
        /// Déclenché lors du clic sur la fenêtre principale afin de pouvoir la déplacer
        /// </summary>
        /// <param name="sender"> Sender object </param>
        /// <param name="e"> Arguments </param>
        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
                this.DragMove();
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Configuration.ConfigurationUtility.RegisterWindowConfig(Window.GetWindow(this));
        }

        private void Window_Initialized(object sender, EventArgs e)
        {
            Configuration.ConfigurationUtility.Configure(Window.GetWindow(this));
        }

        #region Ancien code

        //private void Modify_MouseClick(object sender, RoutedEventArgs e)
        //{
        //    ContentPresenter contentPresenter = Helper.FindVisualChild<ContentPresenter>(content);
        //    DataTemplate template = contentPresenter.ContentTemplate;

        //    TextBox year = (TextBox) template.FindName("year", contentPresenter);
        //    TextBox nom = (TextBox)template.FindName("libelle", contentPresenter);
        //    String id = nom.Tag.ToString();

        //    CoupeManager.Manager.UpdateCoupe(id, nom.Text, year.Text);

        //}

        //private void Add_MouseClick(object sender, RoutedEventArgs e)
        //{
        //    // Ajouter une coupe
        //    ContentPresenter contentPresenter = Helper.FindVisualChild<ContentPresenter>(content);
        //    DataTemplate template = contentPresenter.ContentTemplate;

        //    TextBox nom = (TextBox)template.FindName("libelle", contentPresenter);
        //    TextBox year = (TextBox)template.FindName("year", contentPresenter);

        //    CoupeManager.Manager.AddCoupe(nom.Text, year.Text);
        //}

        //private void Delete_MouseClick(object sender, RoutedEventArgs e)
        //{

        //}
        
        #endregion

    }
}
